Codeforces Solution | 1475A: Odd Divisor

Codeforces | 01 Jun, 2021

Problem Description:


We have to find that a number (n) has an odd divisor or not. In another word, we have to check whether n is divisible by x or not, where x is odd, in addition x is also NOT equal to 1.


For example, if \(n = 2\), n is divisible by 1 and 2. 1 is not considerable and 2 is NOT odd. So, the answer is “NO”.

Let, \(n = 3\), here 3 is divisible by 1 and 3. 3 is odd. So, the answer is “YES”.


Ideological Analysis:


If n is odd, then the output is “YES”. Because n is divisible by itself.


If n is even, we have to check it has any odd factor or not. If we keep dividing an even number by 2 and finally find the result 1, then it has no odd divisor. So, the result is “NO”. And if the result is not 1, that means we find any odd result before, then the number n has an odd divisor. So, the output is “YES”.


Click here for Source Code.

Tanjina Rahman, 01 Jun, 2021


Share this article on →